

export namespace ITree {
    
    //
    export interface Temp {
        
    }

    export interface TreeTest {
        id:string;
        children:string[]
    }
    export interface Node<T = any> {
        id:string
        prev?:string;
        next?:string[]
        data?:T
    }

    // export interface TreeNode<T> {
    //     id:string
    //     node:Ref<T>
    //     children?:TreeNode<T>[]
    // }

    export interface TreeNode {
        id:string
        children?:TreeNode[]
    }

    export type Tree = TreeNode[]

    export interface Option<T = any>{
        key?:string|((data:T) => string) // 关键字 唯一键值 默认 id
        children?:string // 子节点关键字 默认 children
        isClone?:boolean  //  是否克隆对象，不修改原对象
        isLeaf?:string | ((data:T) => boolean) // 是否是叶子节点
        extend?:Record<string,any> // 扩展属性
        exclude?:string[] // 移除的属性
        reset?:(node:Node<T>) => T
    }
    // 树扁平化之后的结果，包含头节点集合  Head 和 叶子节点集合 Leafs
    export type TreeMap<T = any> =  Map<string,Node<T>> & Map<"Head",string[]> & Map<"Leafs",string[]>
}